package com.rzjm.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.rzjm.api.dao.UserShopRelationDao;
import com.rzjm.api.entity.UserShopRelation;
import com.rzjm.api.service.UserShopRelationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service
public class UserShopRelationServiceImpl extends BaseServiceImpl<UserShopRelationDao, UserShopRelation> implements UserShopRelationService {
    @Resource
    private UserShopRelationDao dao;

    @Override
    public UserShopRelation getRelation(Integer shop_id, Long sysUserId) {
        QueryWrapper<UserShopRelation> qw = new QueryWrapper<>();
        qw.eq("sys_user_id",sysUserId);
        qw.eq("shop_id",shop_id);
        qw.last("limit 1");
        UserShopRelation relation = dao.selectOne(qw);
        return relation;
    }
}
